<script setup>
const props = defineProps({
    hotList: Array
})
</script>

<template>

<section class="boxCon">
    <div>
        <img class="title" src="~/assets/resources/index/articleTitle.png" alt="">
    </div>

    <div class="body">
        
        <NuxtLink :to="'/resources/'+item.productId" v-for="(item,index) in hotList" class="articleItem">
            <div class="itemLeft">
                <img class="rankNum" v-if="index == 0" src="~/assets/resources/index/jinpai@2x.png" alt="">
                <img class="rankNum" v-else-if="index == 1" src="~/assets/resources/index/yinpai@2x.png" alt="">
                <img class="rankNum" v-else-if="index == 2" src="~/assets/resources/index/tongpai@2x.png" alt="">
                <div class="rankNum" v-else>
                    {{index+1}}
                </div>
                <h2 class="articletitle">{{item.productName}}</h2>
            </div>

            <p class="info">{{item.productIntro}}</p>
        </NuxtLink>
    </div>

</section>

</template>

<style scoped lang="scss">
h1,h2,p{
    margin: 0;
}
a{
    text-decoration: none;
}
// 多行隐藏
@mixin textoverflow($clamp: 1) {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  -o-text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: $clamp;
  /*! autoprefixer: ignore next */
  -webkit-box-orient: vertical;
}
.boxCon {
    background: linear-gradient( 180deg, #E2E9FB 0%, #F4F7FC 100%);
    border-radius: 10px;
    border: 1px solid #FFFFFF;
    position: relative;
    padding: 10px;
    box-sizing: border-box
}
.title{
    width: 111px;
    display: block;
    margin-bottom: 10px;
}
.body{
    background-color: #ffffff;
    border-radius: 10px;
    padding: 10px 20px;
    .articleItem{
        cursor: pointer;
        display: flex;
        padding: 10px 0;
        justify-content: space-between;
        align-items: center;
        .itemLeft{
            display: flex;
        }
        .rankNum{
            width: 28px;
            height: 28px;
            text-align: center;
            margin-right: 10px;
        }
        .articletitle{
            flex: auto;
            font-weight: normal;
            font-size: 16px;
            line-height: 28px;
            color: #333333;
            margin-right: 10px;
            @include textoverflow;
        }
        .info{
            font-size: 14px;
            color: #999999;
            text-align: right;
            @include textoverflow;
        }
    }
}
.footer{
    margin-top: 12px;
}
.btn{
    cursor: pointer;
    width: 100%;
    border: 1px solid #4384FF;
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3px 0;
    color: #4384FF;
    font-size: 18px;
    .text{
        margin-left: 5px;
    }
}
</style>